A room can paint tiles on three layers - Main (the room's own, the only one with collision), Front (over the player, like treetops) and Back (behind everything, like far hills) - each with its own scroll speed and effect.
A room's tiles are normally one layer: the floor, the walls and everything else you paint with the Room Editor's Tile Palette. That is the Main layer, and it is the only one that blocks things. A room can also have two more layers of tiles:
| Layer | Drawn | Good for |
|---|---|---|
| Front | in front of the Main layer | treetops and roofs, fog, a cave's dark edge |
| Main | the room's own tiles | the floor, the walls, everything that has collision and tile flags |
| Back | behind the Main layer | far hills, far clouds, a cave wall behind the floor |
The extra layers are painted with the same tile set as the Main layer, so they need no new tiles and no new colors: a Front layer of treetops costs nothing but the one background layer it is drawn on.
The Map and the other thumbnails of the room draw every layer.
Each Front or Back layer has its own Scroll speed, across and down, in percent: 100 moves with the room (the default), 50 moves half as far as the camera so the layer looks far away, 0 stays where it is on the screen, and a minus number moves the other way. The layer moves in whole pixels, so it never shakes. A Back layer at 30 or 50 is how you make far hills, and a Front layer at 120 makes a bush that rushes past. room_layer_scroll_speed changes it from code.
Every layer, Main too, has an Effect dropdown. It plays on that one layer while the others stay still, and the Room Editor's canvas plays it live:
The same looks are available from code with room_layer_look (Wobble), screen_mosaic (Blocks) and screen_blend (Fade), each with a layer.
In Layers, every layer is a row you can drag by its grip, among the room's pictures and depth groups: a layer dragged in front of a depth group puts that group's objects behind it. This is how a Front layer of treetops ends up over the player: put the player in a depth group and drag the Front layer in front of that group. (A game with no depth groups draws all its objects in front of every layer.) A room has three drawing levels, so a layer is refused (with the reason) when the order would need a fourth. The eye hides a row and the half-moon button makes it see-through; both are for the editor only, so you can paint on Main while Back is faded. They are not part of the game.
Tile animations (see tile animation) and an autotile's color cycle belong to the tile set, so they play on every layer: a lantern drawn with an animated tile moves on a Front layer, and glowing cracks painted only on a Back layer still cycle their colors.
Collision layers (the numbered versions of a room you switch with tile_layer_set_active) change the Main layer: its collision and the pictures of its squares. A Front or Back layer looks the same in every collision layer, because it is not part of what a collision layer changes. When you paint on a Front or Back layer while a collision layer other than layer 1 is on screen, the Tile layers section reminds you of that. If a door has to look open, draw its open look on Main, or hide a layer with room_layer_visible when the door opens.
| Call | What it does |
|---|---|
room_layer_scroll_speed | changes a layer's scroll speed |
room_layer_visible | shows or hides a layer |
room_layer_look | starts or ends a wobble on a layer |
tile_index and tile_set_index | read and change the picture of a layer's square, with the layer as the last argument |
A layer is named with ROOM_LAYER_MAIN, ROOM_LAYER_FRONT or ROOM_LAYER_BACK. A room that does not have the layer you name does nothing. A game that never adds a layer carries none of this.
A console that cannot draw a room's tiles on separate layers grays out the Tile layers section, and the room is drawn without them.